﻿#####################
REPLICATION MATERIALS
#####################

AUTHORS: Zhou, Xiang
ARTICLE: "Hierarchical Item Response Models for Analyzing Public Opinion."
JOURNAL: Political Analysis
UPDATED: October 23, 2018
CONTACT: xiang_zhou@fas.harvard.edu

INSTRUCTIONS:

To replicate the analysis, please download all files from the Political Analysis Dataverse and put them in the same folder. 

To reproduce Figure 1 and Figure S1, run ''01_sim_v4a.R'', ''02_sim_v4b.R'', ''03_sim_perf.R'', and ''04_sim_out.R'' in turn.

To reproduce Figures 2-5 and Figure S2, run ''05_nes_models.R'', ''06_nes_pca.R'', and ''07_nes_out.R'' in turn.

SOFTWARE:

To run the R files you will need a current version of R (I used R 3.3.2).

R PACKAGES used: 

- dplyr v0.7.2
- emIRT v0.0.8
- ggplot2 v2.2.0
- hIRT v0.1.3
- ltm v1.0-0
- MCMCpack v1.4-0
- microbenchmark v1.4-2.1
- pryr v0.1.2
- rms v5.1-1
- splines v3.3.2
- statmod v1.4.29
- tidyr v0.6.3

RUNNING TIMES:

- Setup:  Dell Desktop, Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz, 16GB RAM

- Operating system: Windows 7 Enterprise SP1

- ''01_sim_v4a.R'' : 18.57 hours

- ''02_sim_v4b.R'': 18.84 hours

- ''03_sim_perf.R'': 4.11 hours

- ''04_sim_out.R'': 3s

- ''05_nes_models.R'': 10.38 mins

- ''06_nes_pca.R'': 1.51 mins

- ''07_nes_out.R'': 8s

NOTE:

If you have any further questions concerning the replication materials, please send an email to Xiang Zhou (xiang_zhou@fas.harvard.edu).
